3.460 \(\int \frac {\cos ^2(c+d x)}{a+b \tan ^2(c+d x)} \, dx\)

Optimal. Leaf size=83 \[ \frac {b^{3/2} \tan ^{-1}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a} d (a-b)^2}+\frac {\sin (c+d x) \cos (c+d x)}{2 d (a-b)}+\frac {x (a-3 b)}{2 (a-b)^2} \]

[Out]

1/2*(a-3*b)*x/(a-b)^2+1/2*cos(d*x+c)*sin(d*x+c)/(a-b)/d+b^(3/2)*arctan(b^(1/2)*tan(d*x+c)/a^(1/2))/(a-b)^2/d/a
^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.10, antiderivative size = 83, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3675, 414, 522, 203, 205} \[ \frac {b^{3/2} \tan ^{-1}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a} d (a-b)^2}+\frac {\sin (c+d x) \cos (c+d x)}{2 d (a-b)}+\frac {x (a-3 b)}{2 (a-b)^2} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2/(a + b*Tan[c + d*x]^2),x]

[Out]

((a - 3*b)*x)/(2*(a - b)^2) + (b^(3/2)*ArcTan[(Sqrt[b]*Tan[c + d*x])/Sqrt[a]])/(Sqrt[a]*(a - b)^2*d) + (Cos[c
+ d*x]*Sin[c + d*x])/(2*(a - b)*d)

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 414

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> -Simp[(b*x*(a + b*x^n)^(p + 1)*(
c + d*x^n)^(q + 1))/(a*n*(p + 1)*(b*c - a*d)), x] + Dist[1/(a*n*(p + 1)*(b*c - a*d)), Int[(a + b*x^n)^(p + 1)*
(c + d*x^n)^q*Simp[b*c + n*(p + 1)*(b*c - a*d) + d*b*(n*(p + q + 2) + 1)*x^n, x], x], x] /; FreeQ[{a, b, c, d,
 n, q}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] &&  !( !IntegerQ[p] && IntegerQ[q] && LtQ[q, -1]) && IntBinomial
Q[a, b, c, d, n, p, q, x]

Rule 522

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 3675

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff/(c^(m - 1)*f), Subst[Int[(c^2 + ff^2*x^2)^(m/2 - 1)*(a + b*(ff*x)
^n)^p, x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2] && (IntegersQ[n, p
] || IGtQ[m, 0] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps

\begin {align*} \int \frac {\cos ^2(c+d x)}{a+b \tan ^2(c+d x)} \, dx &=\frac {\operatorname {Subst}\left (\int \frac {1}{\left (1+x^2\right )^2 \left (a+b x^2\right )} \, dx,x,\tan (c+d x)\right )}{d}\\ &=\frac {\cos (c+d x) \sin (c+d x)}{2 (a-b) d}-\frac {\operatorname {Subst}\left (\int \frac {-a+2 b-b x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\tan (c+d x)\right )}{2 (a-b) d}\\ &=\frac {\cos (c+d x) \sin (c+d x)}{2 (a-b) d}+\frac {(a-3 b) \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (c+d x)\right )}{2 (a-b)^2 d}+\frac {b^2 \operatorname {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\tan (c+d x)\right )}{(a-b)^2 d}\\ &=\frac {(a-3 b) x}{2 (a-b)^2}+\frac {b^{3/2} \tan ^{-1}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a} (a-b)^2 d}+\frac {\cos (c+d x) \sin (c+d x)}{2 (a-b) d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.19, size = 78, normalized size = 0.94 \[ \frac {4 b^{3/2} \tan ^{-1}\left (\frac {\sqrt {b} \tan (c+d x)}{\sqrt {a}}\right )+\sqrt {a} (2 (a-3 b) (c+d x)+(a-b) \sin (2 (c+d x)))}{4 \sqrt {a} d (a-b)^2} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2/(a + b*Tan[c + d*x]^2),x]

[Out]

(4*b^(3/2)*ArcTan[(Sqrt[b]*Tan[c + d*x])/Sqrt[a]] + Sqrt[a]*(2*(a - 3*b)*(c + d*x) + (a - b)*Sin[2*(c + d*x)])
)/(4*Sqrt[a]*(a - b)^2*d)

________________________________________________________________________________________

fricas [A]  time = 0.56, size = 290, normalized size = 3.49 \[ \left [\frac {2 \, {\left (a - 3 \, b\right )} d x + 2 \, {\left (a - b\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \sqrt {-\frac {b}{a}} \log \left (\frac {{\left (a^{2} + 6 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{4} - 2 \, {\left (3 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{2} - 4 \, {\left ({\left (a^{2} + a b\right )} \cos \left (d x + c\right )^{3} - a b \cos \left (d x + c\right )\right )} \sqrt {-\frac {b}{a}} \sin \left (d x + c\right ) + b^{2}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{4} + 2 \, {\left (a b - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}}\right )}{4 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} d}, \frac {{\left (a - 3 \, b\right )} d x + {\left (a - b\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right ) - b \sqrt {\frac {b}{a}} \arctan \left (\frac {{\left ({\left (a + b\right )} \cos \left (d x + c\right )^{2} - b\right )} \sqrt {\frac {b}{a}}}{2 \, b \cos \left (d x + c\right ) \sin \left (d x + c\right )}\right )}{2 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} d}\right ] \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a+b*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

[1/4*(2*(a - 3*b)*d*x + 2*(a - b)*cos(d*x + c)*sin(d*x + c) + b*sqrt(-b/a)*log(((a^2 + 6*a*b + b^2)*cos(d*x +
c)^4 - 2*(3*a*b + b^2)*cos(d*x + c)^2 - 4*((a^2 + a*b)*cos(d*x + c)^3 - a*b*cos(d*x + c))*sqrt(-b/a)*sin(d*x +
 c) + b^2)/((a^2 - 2*a*b + b^2)*cos(d*x + c)^4 + 2*(a*b - b^2)*cos(d*x + c)^2 + b^2)))/((a^2 - 2*a*b + b^2)*d)
, 1/2*((a - 3*b)*d*x + (a - b)*cos(d*x + c)*sin(d*x + c) - b*sqrt(b/a)*arctan(1/2*((a + b)*cos(d*x + c)^2 - b)
*sqrt(b/a)/(b*cos(d*x + c)*sin(d*x + c))))/((a^2 - 2*a*b + b^2)*d)]

________________________________________________________________________________________

giac [A]  time = 1.52, size = 110, normalized size = 1.33 \[ \frac {\frac {2 \, {\left (\pi \left \lfloor \frac {d x + c}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\relax (b) + \arctan \left (\frac {b \tan \left (d x + c\right )}{\sqrt {a b}}\right )\right )} b^{2}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \sqrt {a b}} + \frac {{\left (d x + c\right )} {\left (a - 3 \, b\right )}}{a^{2} - 2 \, a b + b^{2}} + \frac {\tan \left (d x + c\right )}{{\left (\tan \left (d x + c\right )^{2} + 1\right )} {\left (a - b\right )}}}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a+b*tan(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(2*(pi*floor((d*x + c)/pi + 1/2)*sgn(b) + arctan(b*tan(d*x + c)/sqrt(a*b)))*b^2/((a^2 - 2*a*b + b^2)*sqrt(
a*b)) + (d*x + c)*(a - 3*b)/(a^2 - 2*a*b + b^2) + tan(d*x + c)/((tan(d*x + c)^2 + 1)*(a - b)))/d

________________________________________________________________________________________

maple [A]  time = 0.65, size = 137, normalized size = 1.65 \[ \frac {b^{2} \arctan \left (\frac {\tan \left (d x +c \right ) b}{\sqrt {a b}}\right )}{d \left (a -b \right )^{2} \sqrt {a b}}+\frac {\tan \left (d x +c \right ) a}{2 d \left (a -b \right )^{2} \left (1+\tan ^{2}\left (d x +c \right )\right )}-\frac {\tan \left (d x +c \right ) b}{2 d \left (a -b \right )^{2} \left (1+\tan ^{2}\left (d x +c \right )\right )}+\frac {\arctan \left (\tan \left (d x +c \right )\right ) a}{2 d \left (a -b \right )^{2}}-\frac {3 \arctan \left (\tan \left (d x +c \right )\right ) b}{2 d \left (a -b \right )^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2/(a+b*tan(d*x+c)^2),x)

[Out]

1/d*b^2/(a-b)^2/(a*b)^(1/2)*arctan(tan(d*x+c)*b/(a*b)^(1/2))+1/2/d/(a-b)^2*tan(d*x+c)/(1+tan(d*x+c)^2)*a-1/2/d
/(a-b)^2*tan(d*x+c)/(1+tan(d*x+c)^2)*b+1/2/d/(a-b)^2*arctan(tan(d*x+c))*a-3/2/d/(a-b)^2*arctan(tan(d*x+c))*b

________________________________________________________________________________________

maxima [A]  time = 0.44, size = 95, normalized size = 1.14 \[ \frac {\frac {2 \, b^{2} \arctan \left (\frac {b \tan \left (d x + c\right )}{\sqrt {a b}}\right )}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \sqrt {a b}} + \frac {{\left (d x + c\right )} {\left (a - 3 \, b\right )}}{a^{2} - 2 \, a b + b^{2}} + \frac {\tan \left (d x + c\right )}{{\left (a - b\right )} \tan \left (d x + c\right )^{2} + a - b}}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2/(a+b*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*(2*b^2*arctan(b*tan(d*x + c)/sqrt(a*b))/((a^2 - 2*a*b + b^2)*sqrt(a*b)) + (d*x + c)*(a - 3*b)/(a^2 - 2*a*b
 + b^2) + tan(d*x + c)/((a - b)*tan(d*x + c)^2 + a - b))/d

________________________________________________________________________________________

mupad [B]  time = 13.89, size = 254, normalized size = 3.06 \[ -\frac {6\,a\,b\,\mathrm {atan}\left (\frac {\sin \left (c+d\,x\right )}{\cos \left (c+d\,x\right )}\right )-a^2\,\sin \left (2\,c+2\,d\,x\right )-2\,a^2\,\mathrm {atan}\left (\frac {\sin \left (c+d\,x\right )}{\cos \left (c+d\,x\right )}\right )+a\,b\,\sin \left (2\,c+2\,d\,x\right )+\mathrm {atan}\left (\frac {a^2\,b^3\,\sin \left (c+d\,x\right )\,\sqrt {-a\,b^3}\,9{}\mathrm {i}-a^3\,b^2\,\sin \left (c+d\,x\right )\,\sqrt {-a\,b^3}\,6{}\mathrm {i}-a\,b^4\,\sin \left (c+d\,x\right )\,\sqrt {-a\,b^3}\,4{}\mathrm {i}+a^4\,b\,\sin \left (c+d\,x\right )\,\sqrt {-a\,b^3}\,1{}\mathrm {i}}{-\cos \left (c+d\,x\right )\,a^5\,b^2+6\,\cos \left (c+d\,x\right )\,a^4\,b^3-9\,\cos \left (c+d\,x\right )\,a^3\,b^4+4\,\cos \left (c+d\,x\right )\,a^2\,b^5}\right )\,\sqrt {-a\,b^3}\,4{}\mathrm {i}}{4\,d\,a^3-8\,d\,a^2\,b+4\,d\,a\,b^2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2/(a + b*tan(c + d*x)^2),x)

[Out]

-(atan((a^2*b^3*sin(c + d*x)*(-a*b^3)^(1/2)*9i - a^3*b^2*sin(c + d*x)*(-a*b^3)^(1/2)*6i - a*b^4*sin(c + d*x)*(
-a*b^3)^(1/2)*4i + a^4*b*sin(c + d*x)*(-a*b^3)^(1/2)*1i)/(4*a^2*b^5*cos(c + d*x) - 9*a^3*b^4*cos(c + d*x) + 6*
a^4*b^3*cos(c + d*x) - a^5*b^2*cos(c + d*x)))*(-a*b^3)^(1/2)*4i - 2*a^2*atan(sin(c + d*x)/cos(c + d*x)) - a^2*
sin(2*c + 2*d*x) + 6*a*b*atan(sin(c + d*x)/cos(c + d*x)) + a*b*sin(2*c + 2*d*x))/(4*a^3*d + 4*a*b^2*d - 8*a^2*
b*d)

________________________________________________________________________________________

sympy [F(-1)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2/(a+b*tan(d*x+c)**2),x)

[Out]

Timed out

________________________________________________________________________________________